
INCLUDE_DIRECTORIES(${MATLAB_INCLUDE_DIR})

add_library(DoGridding SHARED DoGridding.cpp ${CMAKE_SOURCE_DIR}/Matlabdef.def)
target_link_libraries(DoGridding ${MATLAB_LIBRARIES})

if(WIN32)
  if (CMAKE_CL_64)
      SET_TARGET_PROPERTIES(DoGridding PROPERTIES SUFFIX .mexw64)
  else(CMAKE_CL_64)
      SET_TARGET_PROPERTIES(DoGridding PROPERTIES SUFFIX .mexw32)
  endif(CMAKE_CL_64)
else(WIN32)
  if (CMAKE_SIZEOF_VOID_P MATCHES "8")
      SET_TARGET_PROPERTIES(DoGridding PROPERTIES SUFFIX .mexa64 PREFIX "")
  else(CMAKE_SIZEOF_VOID_P MATCHES "8")
      SET_TARGET_PROPERTIES(DoGridding PROPERTIES SUFFIX .mexglx PREFIX "")
  endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
endif(WIN32)

install(TARGETS DoGridding DESTINATION ../bin)
